#!/usr/bin/env bash
read -p "请输入1关机，2重启：" num
sudo=""
if [ $(id -u) -eq 0 ]; then
  sudo=""
else
  sudo=sudo
fi

if [ $num -eq 1 ]; then
  $sudo shutdown -h now
elif [ $num -eq 2 ]; then
  $sudo shutdown -r now
else
  echo "输入错误"
fi
